package com.dzsw.javabase.collection;

import org.apache.commons.lang3.StringUtils;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class MapSample {

    public static void main(String[] args) {
        Map<Integer, String> map = new HashMap<>();
        for (int i = 0; i < 10000; i++) {
            map.put(i,"str_" + i);
        }
        Iterator<Integer> iterator = map.keySet().iterator();
        while (iterator.hasNext()) {
            Integer key = iterator.next();
            System.out.println(map.get(key));
        }

        for (Map.Entry<Integer, String> entry : map.entrySet()) {
            System.out.println(entry.getKey() + ":" + entry.getValue());
        }

        for (int i = 0; i < 10000; i++) {
            int j = 0;
            for (Map.Entry<Integer, String> entry : map.entrySet()) {
                if (!StringUtils.equals(entry.getValue(),"str_" + j)) {
                    System.out.println(entry.getKey() + ":" + entry.getValue());
                }
                j++;
            }
        }
    }
}
